package programmer;

import java.io.File;

public class Filename {
  private static char pathSeparator = File.separatorChar;
  private static char extensionSeparator = '.';

  public static Boolean checkExtension(File file, String type) {
	  String fullpath = file.getAbsolutePath();
	  int dot = fullpath.lastIndexOf(extensionSeparator);
	  return fullpath.substring(dot + 1).equals(type);
  }

  public static String fileName(File file) {
	  String fullpath = file.getAbsolutePath();
	  int dot = fullpath.lastIndexOf(extensionSeparator);
	  int slash = fullpath.lastIndexOf(pathSeparator);
	  return fullpath.substring(slash+1, dot);
  }
}